/**
 * 
 */
package robot;

import javax.vecmath.Point2d;
import javax.vecmath.Vector3d;

import program.MovingObjects;

/**
 * Moves to new random point
 * @date 7 maj 2012
 * @version 1.0
 */
public class RandomRobot extends Robot {
	private Point2d goal;
	public static final double ACCEPT_DISTANCE = 1;

	/**
	 * @param position
	 * @param name
	 * @param mo
	 */
	public RandomRobot(Vector3d position, String name, MovingObjects mo) {
		super(position, name, mo);
	}
	
	@Override
	public void performBehavior () {
		if (goal == null || goal.distance(getCurrentPosition()) < ACCEPT_DISTANCE) {
			setTranslationalVelocity(0);
			int size = 20;
			goal = new Point2d (Math.random() * size - size / 2
						, Math.random() * size - size / 2);
			rotateTowardsNextGoal(goal);
			setTranslationalVelocity(1);
		}	
		
	}

}
